package cn.wolfcode.trip.base.domain;

import lombok.Getter;
import lombok.Setter;

import java.util.HashMap;
import java.util.Map;

//旅游区域对象
@Setter@Getter
public class Region extends BaseDomain {
    public static final Integer STATE_NOMAL = 0; //普通
    public static final Integer STATE_COMMEND = 1; //推荐

    private String name; //区域名称

    private Integer state = STATE_NOMAL; //状态

    private Region parent; //父区域

    //{text:"xx", tags:["xx"], id:xx, lazyLoad: true}
    public Map<String, Object> toTreeView() {
        Map<String, Object> map = new HashMap<>();
        map.put("id", id);
        map.put("text", name);
        map.put("lazyLoad", true);
        //用于标签
        if (state == STATE_COMMEND) {
            map.put("tags", new String[]{"推荐"});
        }
        return map;
    }
}